/*
 * @Author: Donald duck tang5722917@163.com
 * @Date: 2024-06-03 11:52:47
 * @LastEditors: Donald duck tang5722917@163.com
 * @LastEditTime: 2024-06-28 18:59:42
 * @FilePath: \mysticism-mud\lpc_atest\lpc_atest_unit.c
 * @Description: 
 * Copyright (c) 2024 by Donald duck email: tang5722917@163.com, All Rights Reserved.
 */

inherit LPC_ATEST_PATH "lpc_assert";

nosave mapping test_info;

void ATEST_BEGIN(){
    test_info = ([]);
    test_info["test_func"] = ({});
    test_info["test_func_judge"] = ({});
}

void run_string(string test_func){
    test_info["test_func"] += ({test_func});
    set_test_func(test_func);
    this_object()->assert_info_init();
    call_other(this_object(),test_func);
    test_info["test_func_judge"] += assert_info_end();
}

void ATEST_END(){
    ;
}

string * get_result_info(){return test_info["test_func_judge"];}

string get_test_info(){return this_object()->info();}

int get_result(){
    if (sizeof( test_info["test_func_judge"] ) == 0) return -1;
    foreach(int j in test_info["test_func_judge"]){
        if(j == 0) return 0;
        else if(j == -1) return -1;
    }
    return 1;
}
